package com.threaddemo1;

public class ThreadGroupDemo {
    public static void main(String[] args) throws InterruptedException {
        ThreadGroup tg = new ThreadGroup("tg");

        Thread t1 = new Thread(tg, new Runnable() {
            @Override
            public void run() {
                System.out.println("t1");
            }
        });
        Thread t2 = new Thread(tg, new Runnable() {
            @Override
            public void run() {
                System.out.println("t2");
            }
        });
        Thread t3 = new Thread(tg, new Runnable() {
            @Override
            public void run() {
                System.out.println("t3");
            }
        });
        tg.setMaxPriority(Thread.MAX_PRIORITY);
        t1.start();
        t2.start();
        t3.start();


        tg.list();

        //tg.uncaughtException(t1,new RuntimeException("让T1抛出异常"));
        //Thread.sleep(3 * 1000);
        System.out.println("线程活跃数：" + tg.activeCount());

    }
}
